<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>browserchannel.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
       <span class="fn">browserchannel.js</span>
</div>

<div class="g-section g-tpl-75-25">
  <div class="g-unit g-first" id="description">
    <span class='nodesc'>No description.</span>
  </div>
  

        <div class="g-unit" id="useful-links">
          <div class="title">Useful links</div>
          <ol>
            <li><a href="local_closure_goog_net_browserchannel.js.source.html"><span class='source-code-link'>Source Code</span></a></li>
            <li><a href="http://code.google.com/p/closure-library/source/browse/local/closure/goog/net/browserchannel.js">Git</a></li>
          </ol>
        </div>
</div>

<h2 class="g-first">File Location</h2>
  <div class="g-section g-tpl-20-80">
    <div class="g-unit g-first">
      <div class="g-c-cell code-label">/goog/net/browserchannel.js</div>
    </div>
  </div>
<hr/>


  <h2>Classes</h2>
 <div class="fn-constructor">
        <a href="class_goog_net_BrowserChannel.html">
          goog.net.BrowserChannel</a><br/>
        <div class="class-details">Encapsulates the logic for a single BrowserChannel.

</div>
 </div>
 <div class="fn-constructor">
        <a href="class_goog_net_BrowserChannel_Handler.html">
          goog.net.BrowserChannel.Handler</a><br/>
        <div class="class-details">Abstract base class for the browser channel handler
</div>
 </div>
 <div class="fn-constructor">
        <a href="class_goog_net_BrowserChannel_QueuedMap.html">
          goog.net.BrowserChannel.QueuedMap</a><br/>
        <div class="class-details">Simple container class for a (mapId, map) pair.
</div>
 </div>
 <div class="fn-constructor">
        <a href="class_goog_net_BrowserChannel_ServerReachabilityEvent.html">
          goog.net.BrowserChannel.ServerReachabilityEvent</a><br/>
        <div class="class-details">Event class for goog.net.BrowserChannel.Event.SERVER_REACHABILITY_EVENT.

</div>
 </div>
 <div class="fn-constructor">
        <a href="class_goog_net_BrowserChannel_StatEvent.html">
          goog.net.BrowserChannel.StatEvent</a><br/>
        <div class="class-details">Event class for goog.net.BrowserChannel.Event.STAT_EVENT

</div>
 </div>
 <div class="fn-constructor">
        <a href="class_goog_net_BrowserChannel_TimingEvent.html">
          goog.net.BrowserChannel.TimingEvent</a><br/>
        <div class="class-details">Event class for goog.net.BrowserChannel.Event.TIMING_EVENT

</div>
 </div>
      
<br/>

  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>



<h2>Enumerations</h2>






<div class="section">
  <table class="horiz-rule">


  </table>
</div>




  <h2>Global Functions</h2>





<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.net.BrowserChannel.createChannelRequest"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.net.BrowserChannel.</span><span class="entryName">createChannelRequest<span class="args">(<span class="arg">channel</span>,&nbsp;<span class="arg">channelDebug</span>,&nbsp;<span class="arg">opt_sessionId</span>,&nbsp;<span class="arg">opt_requestId</span>,&nbsp;<span class="arg">opt_retryId</span>)</span>
        </span>
        &#8658; <span>!</span><span class="type"><a href="class_goog_net_ChannelRequest.html">goog.net.ChannelRequest</a></span>
      </div>


     <div class="entryOverview">
       Instantiates a ChannelRequest with the given parameters. Overidden in tests.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">channel</span>
        : <span class="type"><a href="class_goog_net_BrowserChannel.html">goog.net.BrowserChannel</a></span><span>&nbsp;|&nbsp;</span><span class="type"><a href="class_goog_net_BrowserTestChannel.html">goog.net.BrowserTestChannel</a></span>
        <div class="entryOverview">The BrowserChannel that owns this request.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">channelDebug</span>
        : <span class="type"><a href="class_goog_net_ChannelDebug.html">goog.net.ChannelDebug</a></span>
        <div class="entryOverview">A ChannelDebug to use for
    logging.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_sessionId</span>
        : <span class="type">string=</span>
        <div class="entryOverview">The session id for the channel.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_requestId</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span><span>&nbsp;|&nbsp;</span><span class="type">number=</span>
        <div class="entryOverview">The request id for this request.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_retryId</span>
        : <span class="type">number=</span>
        <div class="entryOverview">The retry id for this request.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>!</span><span class="type"><a href="class_goog_net_ChannelRequest.html">goog.net.ChannelRequest</a></span>&nbsp;
            The created channel request.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line911">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="function%40&fn"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace"></span><span class="entryName">function%40&fn<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line2575">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.net.BrowserChannel.getStatEventTarget"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.net.BrowserChannel.</span><span class="entryName">getStatEventTarget<span class="args">()</span>
        </span>
        &#8658; <span class="type"><a href="class_goog_events_EventTarget.html">goog.events.EventTarget</a></span>
      </div>


     <div class="entryOverview">
       Returns the singleton event target for stat events.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="class_goog_events_EventTarget.html">goog.events.EventTarget</a></span>&nbsp;
            The event target for stat events.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line2451">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.net.BrowserChannel.isFatalError_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.net.BrowserChannel.</span><span class="entryName">isFatalError_<span class="args">(<span class="arg">error</span>,&nbsp;<span class="arg">statusCode</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>
      </div>


     <div class="entryOverview">
       Returns whether or not the given error/status combination is fatal or not.
On fatal errors we immediately close the session rather than retrying the
failed request.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">error</span>
        : <span>?</span><span class="type">goog.net.ChannelRequest.Error</span>
        <div class="entryOverview">The error code for the failed
request.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">statusCode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The last HTTP status code.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>&nbsp;
            Whether or not the error is fatal.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line1973">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.net.BrowserChannel.notifyStatEvent"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.net.BrowserChannel.</span><span class="entryName">notifyStatEvent<span class="args">(<span class="arg">stat</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Helper function to call the stat event callback.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">stat</span>
        : <span class="type">goog.net.BrowserChannel.Stat</span>
        <div class="entryOverview">The stat.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line2474">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.net.BrowserChannel.notifyTimingEvent"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.net.BrowserChannel.</span><span class="entryName">notifyTimingEvent<span class="args">(<span class="arg">size</span>,&nbsp;<span class="arg">rtt</span>,&nbsp;<span class="arg">retries</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Helper function to notify listeners about POST request performance.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">size</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">Number of characters in the POST data.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">rtt</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The amount of time from POST start to response.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">retries</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The number of times the POST had to be retried.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line2488">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.net.BrowserChannel.onEndExecution"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.net.BrowserChannel.</span><span class="entryName">onEndExecution<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       Helper function to call the end hook

     </div>

   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line2442">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.net.BrowserChannel.onStartExecution"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.net.BrowserChannel.</span><span class="entryName">onStartExecution<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       Helper function to call the start hook

     </div>

   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line2434">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.net.BrowserChannel.setEndThreadExecutionHook"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.net.BrowserChannel.</span><span class="entryName">setEndThreadExecutionHook<span class="args">(<span class="arg">endHook</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Allows the application to set an execution hooks for when BrowserChannel
stops processing requests. This is useful to track timing or logging
special information. The function takes no parameters and return void.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">endHook</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function">Function</a></span>
        <div class="entryOverview">The function for the end hook.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line876">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.net.BrowserChannel.setStartThreadExecutionHook"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.net.BrowserChannel.</span><span class="entryName">setStartThreadExecutionHook<span class="args">(<span class="arg">startHook</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Allows the application to set an execution hooks for when BrowserChannel
starts processing requests. This is useful to track timing or logging
special information. The function takes no parameters and return void.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">startHook</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function">Function</a></span>
        <div class="entryOverview">The function for the start hook.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line865">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.net.BrowserChannel.setTimeout"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.net.BrowserChannel.</span><span class="entryName">setTimeout<span class="args">(<span class="arg">fn</span>,&nbsp;<span class="arg">ms</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
      </div>


     <div class="entryOverview">
       Wrapper around SafeTimeout which calls the start and end execution hooks
with a try...finally block.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">fn</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function">Function</a></span>
        <div class="entryOverview">The callback function.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">ms</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The time in MS for the timer.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>&nbsp;
            The ID of the timer.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line2416">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>






  <h2>Global Variables</h2>





<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>





  <a name="function%39"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">function%39</span>
        : 
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line2561">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>





  <a name="function%40"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">function%40</span>
        : 
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line2570">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>





  <a name="function%41"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">function%41</span>
        : 
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line2589">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>





  <a name="function%42"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">function%42</span>
        : 
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line2599">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>





  <a name="function%43"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">function%43</span>
        : 
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_net_browserchannel.js.source.html#line2607">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Directory net</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">File Reference</h2>
            <div id="sideFileIndex" rootPath="" current="/goog/net/browserchannel.js"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
